package com.yy.device.api.web;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 返回值包装类
 *
 * @author sunzhiqiang
 * @since 3.1.0
 */
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class APIModel {
    /**
     * 状态码
     */
    @Builder.Default
    private int code = 0;
    /**
     * 状态描述
     */
    @Builder.Default
    private String msg = "success";

    /**
     * 数据
     */
    private Object data;

    public void set(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    @Override
    public String toString() {
        return "APIModel{"
                + ", code=" + code
                + ", msg=" + msg
                + ", data=" + data
                + '}';
    }
}
